package jiejie;

import java.util.Arrays;

public class test {
    public static void main(String[] args) {
        int[] nums = {1,5,3,2,4,7,9,8,6};
        int target=91;
        System.out.println(erfen(nums,target));
    }
    public static boolean erfen(int[] nums, int target){
        Arrays.sort(nums);
        int left=0;
        int right=nums.length-1;
        while(left<=right){
            int mid = (left+right)/2;
            if(nums[mid]==target){
                return true;
            }
            else if(nums[mid]>target){
                right=mid-1;
            }
            else{
                left=mid+1;
            }
        }
        return false;
    }
}
